assertTrue(byLengthOrdering.reverse().isOrdered(list));
OrderingIs the "smooth version" of Guava"ComparatorIt is used to build advanced comparator and apply comparator to various collections ).
OrderingThe instance is just a special
Ordering
Natural ()
Natural sorting(Natural ordering ).
Ordering I read many times in Chinese documents, add some examples finally figure out what's going on.What's he doing? Just like his name, used to ordering sort. 、There are two main ways of doing this.1 is sorted by its static method. such as Ordering.natural (); make a natural sort of sortable type, such as number by size, date by order. Natual () The official interpretation of the translation. 2
Using the Guava Sorting tool class, the high-speed implementation of the object's single-variable ordering and multivariable sequencing, so that your development efficiency exploded ...Import Com.google.common.collect.lists;import Com.google.common.collect.ordering;import Com.google.common.primitives.ints;import Java.util.collections;import Java.util.comparator;import Java.util.iterator;import Java.util.lis
of implementing object simpler, such as hashcode () and ToString ()
order (ordering ) : Provides a guava powerful "fluent Comparator" class ( The ordering of the object is defined by the fluent code, as described in the document that links past)
exception () : Simplifies propagation and validation of exceptions and errors
, extend, and treat as comparators, sorting provides a lot of control over the set sort;Examples are as follows:Lists.newarraylist (30, 20, 60, 80, 10);Ordering.natural (). sortedcopy (numbers); 10,20,30,60,80Ordering.natural (). Reverse (). Sortedcopy (numbers); 80,60,30,20,10Ordering.natural (). min (numbers); 10Ordering.natural (). Max (numbers); 80Lists.newarraylist (+, 10);Ordering.natural (). Nullslast (). sortedcopy (numbers); Ten, 20,30,60,80,nullOrdering.natural (). Nullsfirst (). sorte
Guava is an extended project of Google's java1.6-based class library collection, including collections, caching, primitives support, concurrency libraries, common Annotati ONS, string processing, I/O, and so on. These high-quality APIs can make your Java code more elegant and concise, making your work easier and more enjoyable. Let's start the elegant Java programming learning journey! Project related information: official homepage: http://code.goo
>
Guava is a Google Extension Project Based on java1.6 class library collection, including collections, caching, primitives support, concurrency libraries, common annotations, string processing, I/O, and so on. these high-quality APIs can make your Java code more elegant, concise, and easier to work. Next we will start the elegant Java programming learning journey!
Project information:
Http://code.google.com/p/g
Original address: Guava Library Learning: Learning Guava Files Series (ii) Previous, Guava Library learning: Learning Guava Files Series (a), we simply learned to use files for file reading and writing, such as common operations, this article we continue to guava files serie
Guava is a Google Extension Project Based on java1.6 class library collection, including collections, caching, primitives support, concurrency libraries, common annotations, string processing, I/O, and so on. these high-quality APIs enable your JavaCodeIt is more elegant and concise, making your work easier and more pleasant. Next we will start the elegant Java programming learning journey!
Project information:
Http://code.google.com/p/
Guava database introduction, guava Database1. What is Guava?
1) The Guava library is a common tool library suitable for many Java projects.2) The Guava tool library contains: collection, concurrent Concurrency, Primitive, Reflection, Comparison of Comparison, I/O operations,
Original address: Guava Library Learning: Learning Guava Cache (vi) cachestats Previous article,Guava Library Learning: Learning Guava Cache (v) cacheloader , we learned Cacheloader abstract class, mainly from the method, To receive a function or supplier and return a Cacheloader instance, we have learned how to crea
Original address: Guava Library Learning: Learning Guava Files Series (i) For program developers, the ability to read and write files is an important skill. But surprisingly, while Java provides a rich and robust I/O library, it is cumbersome to perform some basic file operations. But there have been some changes in Java 7, but those that use Java 6 are less fortunate. Fortunately,
Guava includes some core libraries used by Google in Java projects: collections, caching, primitives support, concurrency library, common annotations, string processing, and I/O. Google engineers use these tools every day during development.
However, it is not the most effective method to read Javadoc by learning how to make good use of these libraries. Here, we try to introduce the most common and powerful features of
Guava Study notes: Guava cacheReprint: Http://outofmemory.cn/java/guava/cache/how-to-use-guava-cacheThere is a cache package in Google Guava, which provides memory caching capabilities. There are many issues to be considered in memory caching, including concurrency issues, c
Guava study notes: The meaning of immutable sets of guavaImmutable objects have many advantages, including:
When an object is called by an untrusted library, the immutable form is secure;
When an immutable object is called by multiple threads, there is no race condition problem
Immutable collections do not need to consider changes, so you can save time and space. All immutable collections have better memory utilization (analysis and t
Guava is a Google Extension Project Based on java1.6 class library collection, including collections, caching, primitives support, concurrency libraries, common annotations, string processing, I/O, and so on. these high-quality APIs can make your JAVa code more elegant, concise, and easier to work. Next we will start the elegant Java programming learning journey!
Project information:
Http://code.google.com/p/gua
Original address:Guava Library Learning: Learning Guava Cache Knowledge Summary At this point, we ended our learning of the guava cache caching mechanism, and during the learning process we learned how to simply create the simplest concurrentmap cache through mapmaker, and we also learned about the advanced features of the cache and the powerful Loadingcache We also explored and learned the Cachebuilder, Ca
RateLimit-Example code of interface throttling using guava, ratelimit-guava
This article focuses on RateLimit-using guava for interface throttling.
I. Problem Description
One day, Mr. A suddenly found that his Interface request volume suddenly rose to 10 times of the previous one. Not long ago, the interface was almost unavailable and triggered A chain reaction,
Original address: http://www.xx566.com/detail/184.html In the software development process, the sharing of object information and direct collaboration with each other is necessary, the difficulty is to ensure that the communication between the objects is effectively completed, rather than the cost of highly coupled components. When an object has too much detail about the responsibilities of other components, it is considered highly coupled. When an application has a high degree of coupling, main
Guava Learning notes: manipulating strings in guavaReprint: Http://outofmemory.cn/java/guava/base/StringsIn Google Guava, it provides a great convenience for string manipulation, with an established judgment string whether it is an empty string or null, fills a string with a specified character, splits a merged string, determines the string match, and so on.Let's
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.